<template>
  <Tabbar v-model="active">
    <TabbarItem name="home" to="/">
      <span>首页</span>
      <template #icon="props">
        <svg-icon :iconClass="props.active ? 'home_active' : 'home'"></svg-icon>
      </template>
    </TabbarItem>
    <TabbarItem name="repayment" to="/repayment">
      <span>还款</span>
      <template #icon="props">
        <svg-icon
          :iconClass="props.active ? 'repayment_active' : 'repayment'"
        ></svg-icon>
      </template>
    </TabbarItem>
    <TabbarItem name="userCenter" to="/userCenter">
      <span>我的</span>
      <template #icon="props">
        <svg-icon
          :iconClass="props.active ? 'userCenter_active' : 'userCenter'"
        ></svg-icon>
      </template>
    </TabbarItem>
  </Tabbar>
</template>

<script>
import SvgIcon from '../SvgIcon/index.vue'
import { Tabbar, TabbarItem } from 'vant'
export default {
  name: 'TabBar',
  components: { Tabbar, TabbarItem, SvgIcon },
  props: {
    name: {
      type: String,
      default: 'home'
    }
  },
  data() {
    return {
      active: this.name
    }
  }
}
</script>

<style lang="less" scoped></style>
